<script lang="ts" setup>
import { type RouteRecordName, type RouteRecordRaw, useRouter } from "vue-router"
import { useUserStore } from "@/store/modules/user"
const userStore = useUserStore()
import ConsumerIndex from './consumerIndex.vue'
import LogisticsStaff from './logisticsStaff.vue'
const router = useRouter()
function goto(path: string) {
  router.push({ path })
}

function win() {
  window.open('https://baidu.com/', '_blank')
}
const logout = () => {
  userStore.logout()
  router.push("/login")
}
const name = window.localStorage.getItem('username')
if (name === 'ck') {
  goto('/taskOverview/list')
}
</script>

<template>
  <div class="w-full p-5 pt-5 h-full bg-white">
    <div class="h-full">
      <div class="text-right">
        <el-icon @click="logout"><Upload /></el-icon>
      </div>
      <div v-if="name === 'yh'" class="h-full">
        <ConsumerIndex />
      </div>
      <div v-if="name === 'ckyg'" class="h-full">
        <LogisticsStaff />
      </div>
      <div v-else class="h-full">
        <div class="flex justify-between mb-5">
          <!-- <img class="w-8/12 rounded-lg" src="/dashboard.png" alt="" /> -->
          <img class="w-8/12 rounded-lg" src="/bg2.jpeg" style="height: 50vh;" alt="" />
          <img class="w-3.8/12 border border-solid rounded-lg border-slate-300" src="/g.png" alt="" @click="goto('/comprehensive/index')" />
        </div>
        <div class="grid grid-cols-4 gap-4 h-2/6">
          <div
            class="bg-slate-200 h-full rounded-lg p-5 cursor-pointer"
            style="background-image: url('/wls.png'); background-size: cover;"
          >
            <div class="">
              <span class="text-white font-bold text-2xl bg-black/50 p-3 mb-2 rounded-lg">物流中心</span>
              <div class="my-5 bg-black/50 p-3 rounded-lg text-white">小型配套件，工具件，小型设备的场地搬运</div>
              <div class="mb-3">
                <el-button type="primary" @click="goto('/shuttlebus/special')">配送</el-button>
                <el-button type="primary" @click="goto('/shuttlebus/index')">班车</el-button>
                <el-button type="primary" @click="goto('/car/heatmap')">设备</el-button>
                <el-button type="primary" @click="goto('/plan/index')">计划</el-button>
              </div>
              <div class="mb-3">
                <el-button type="primary" @click="goto('/security/index')">安全</el-button>
                <el-button type="primary" @click="goto('/organization/index')">组织架构</el-button>
                <el-button type="primary">集控管理</el-button>
                <!-- 数字地图 -->
              </div>
            </div>
          </div>
          <div class="bg-white h-full rounded-lg p-5 cursor-pointer"
          style="background-image: url('/cks.png'); background-size: cover;"
          >
            <span class="bg-black/50 text-white font-bold rounded-lg text-2xl p-3" @click="goto('/warehouse')">仓储管理</span>
            <div class=" bg-black/50 text-white my-5 p-3 rounded-lg" >物资部门、库管库员使用，出入库、盘库、外协发运入库</div>
            <!-- <div class="pt-3">
              <div class="mb-3">
                <el-button type="primary" @click="goto('/label-manage/rkd')">入库</el-button>
                <el-button type="primary" @click="goto('/label-manage/ckd')">出库</el-button>
                <el-button type="primary" @click="goto('/warehouse/inventorying')">盘库</el-button>
              </div>
              <div class="mb-3">
                <el-button type="primary" @click="goto('/labels/warehouseDetail')">1#库</el-button>
                <el-button type="primary" @click="goto('/labels/warehouseDetail')">2#库</el-button>
                <el-button type="primary" @click="goto('/labels/warehouseDetail')">3#库</el-button>
              </div>
              <div>
                <el-button type="primary" @click="goto('/labels/warehouseDetail')">涂装1#库</el-button>
                <el-button type="primary" @click="goto('/labels/warehouseDetail')">涂装2#库</el-button>
              </div>
            </div> -->
          </div>
          <div class="bg-white h-full rounded-lg p-5 cursor-pointer"
          style="background-image: url('/clw.png'); background-size: cover;"
          @click="win"
          >
            <span class="bg-black/50 rounded-lg mb-2 text-white font-bold text-2xl p-3" >车联网</span>
            <div class=" bg-black/50 rounded-lg  text-white my-5 p-3">设备升级2G-4G，车辆点检表、维修保养记录、交接班记录</div>
          </div>
          <div
            class="bg-white h-full rounded-lg p-5 cursor-pointer"
            style="background-image: url('/zh.png'); background-size: cover;"
            @click="goto('/comprehensive/index')"
          >
            <span class=" bg-black/50 text-white rounded-lg font-bold text-2xl p-3">综合事务处</span>
            <div class=" bg-black/50 text-white rounded-lg my-5 p-3">发布、更新、关闭公告内容</div>
          </div>
        </div>
      </div>

      <!-- <img src="/home.png" class="w-full h-full" alt=""> -->
    </div>
  </div>
</template>
